const { Random } = require("mockjs")
const Mock = require("mockjs")
const Home = require("../model/Home")


//创建数据的函数
async function homeDataBanner() {
  //酒店列表数据
  const { bannerList } = Mock.mock({
    "bannerList": [{
      "banner|3": [{
        "picUrl|1": Random.image("300x200", "#50B347", "#FFF", "@cname"),
        "picUrl|1": Random.image("300x200", "#50B347", "#FFF", "@cname"),
        "picUrl|1": Random.image("300x200", "#50B347", "#FFF", "@cname"),
      }],
    }]
  })
  const res = await Promise.all(
    bannerList.map((item) => {
      // console.log(item);
      return Home.create(item)
    })
  )
}


module.exports = homeDataBanner